package main

import "fmt"

//数组与切片
func main() {
	//四种初始化数组的方式
	var numArr01 [3]int = [3]int{1, 2, 3}
	fmt.Println("numArr01", numArr01)

	var numArr02 = [3]int{1, 2, 3}
	fmt.Println("numArr02", numArr02)

	var numArr03 = [...]int{1, 2, 3}
	fmt.Println("numArr03", numArr03)

	var numArr04 = [...]int{1: 111, 2: 222, 3: 333}
	fmt.Println("numArr04", numArr04)

	//类推导
	strArr05 := [...]string{1: "tom", 2: "jack"}
	fmt.Println("strArr05", strArr05)

	//演示for-rang遍历数组
	for index, vlaue := range strArr05 {
		fmt.Println(index, vlaue)
	}
}
